//
//  PackageView.m
//  DingDongXiChe
//
//  Created by wtjr on 2017/11/27.
//  Copyright © 2017年 xieyingze. All rights reserved.
//

#import "PackageCell.h"

@interface PackageCell()

@property (nonatomic, strong) UIView *mainView;
/**
  套餐名称
 */
@property (nonatomic, strong) BaseLabel *nameLabel;

/**
 套餐价格
 */
@property (nonatomic, strong) BaseLabel *priceLabel;
/**
 套餐服务时长
 */
@property (nonatomic, strong) BaseLabel *durationLabel;

@end

@implementation PackageCell


#pragma mark - BaseMethod

- (void)initData {
    
}

- (void)initSubViews {
    [self addSubview:self.mainView];
}

- (void)autoLayoutSubViews {
    [self.mainView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(@0);
    }];
    [self setViewShadow:kCOLOR_shadow offset:CGSizeMake(0, 0) radius:3];
}

- (void)bindViewModel {
    
}

#pragma mark - Interface


#pragma mark - Delegate


#pragma mark - TouchEvent


#pragma mark - Setter

- (void)setModel:(PackageModel *)model {
    _model = model;
    self.priceLabel.text = [NSString stringWithFormat:@"¥%.2f",model.package_price];
    self.nameLabel.text = model.package_name;
    self.durationLabel.text = [NSString stringWithFormat:@"%ldmm",model.package_duration];
}

#pragma mark - Getter

- (UIView *)mainView {
    if (!_mainView) {
        _mainView = [UIView new];
        _mainView.backgroundColor = kCOLOR_white;
        
        BaseLabel *priceLabel = [BaseLabel new];
        [priceLabel setLabelStyle:@"¥58" textColor:KCOLOR_mainColor textFont:kFONT_HelBold(24) texrAlignment:NSTextAlignmentRight];
        self.priceLabel = priceLabel;
        [_mainView addSubview:priceLabel];
        [priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(@-20);
            make.bottom.equalTo(@-20);
            make.height.equalTo(@30);
        }];
        
        BaseLabel *nameLabel = [BaseLabel new];
        [nameLabel setLabelStyle:@"尊享洗车套餐" textColor:KCOLOR_font_special textFont:kFONT_mainFont(16) texrAlignment:NSTextAlignmentLeft];
        self.nameLabel = nameLabel;
        [_mainView addSubview:nameLabel];
        [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(@20);
            make.right.equalTo(priceLabel.mas_left).offset(-10);
            make.top.equalTo(@20);
            make.height.equalTo(@20);
        }];
        
        BaseLabel *durationLabel = [BaseLabel new];
        [durationLabel setLabelStyle:@"60min" textColor:KCOLOR_font_light textFont:kFONT_mainFont(12) texrAlignment:NSTextAlignmentLeft];
        self.durationLabel = durationLabel;
        [_mainView addSubview:durationLabel];
        [durationLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(nameLabel);
            make.top.equalTo(nameLabel.mas_bottom).offset(20);
            make.height.equalTo(@20);
        }];
    }
    return _mainView;
}

@end
